import { get, post } from '../../utils/request'
const state = {
  // 用来保存查询出来的用户信息
  client: []
}

const actions = {
  findAllclient(context) {
    // 异步操作
    get('/baseUser/cascadeRoleFindAll').then((res) => {
      let response = res.data
      context.commit('setclient', response)
      console.log(res.data[0]);
    })
  },
  // 保存用户信息
  saveClient(context, from) {
    let response = post('/baseUser/saveOrUpdate', from)
    return response
  }
}

const mutations = {
  // 修改state中的值
  setclient(state, response) {
    state.client = response
  }
}

export default {
  namespaced: true,
  state,
  actions,
  mutations
}
